Behave as documented and close the loader when returning FALSE.
authorMatthias Clasen <mclasen@redhat.com>
Sun, 10 Dec 2006 04:25:46 +0000 (04:25 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 10 Dec 2006 04:25:46 +0000 (04:25 +0000)
2006-12-09  Matthias Clasen  <mclasen@redhat.com>

        * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Behave as
        documented and close the loader when returning FALSE.

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-loader.c

index 9f6940f202dbf1dbc81efca342fb0d1155ca3993..de1501f126aa7f5e215a0af6e27327e77664e530 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-09  Matthias Clasen  <mclasen@redhat.com>
+
+       * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Behave as
+       documented and close the loader when returning FALSE.
+
 2006-10-29  Tor Lillqvist  <tml@novell.com>
 
        * pixbufloader_*.def
index b03f06e83edc23073a3cca85d4e94dd434a4628d..977d8de23c74b6048e8384f2d8ea26ec63c66723 100644 (file)
@@ -455,10 +455,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
       
                         eaten = gdk_pixbuf_loader_eat_header_write (loader, buf, count, error);
                         if (eaten <= 0)
-                                {
-                                        gdk_pixbuf_loader_ensure_error (loader, error);
-                                        return FALSE;
-                                }
+                               goto fail; 
       
                         count -= eaten;
                         buf += eaten;
@@ -466,16 +463,25 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
   
         if (count > 0 && priv->image_module->load_increment)
                 {
-                        gboolean retval;
-                        retval = priv->image_module->load_increment (priv->context, buf, count,
-                                                                     error);
-                        if (!retval)
-                                gdk_pixbuf_loader_ensure_error (loader, error);
-
-                        return retval;
+                        if (!priv->image_module->load_increment (priv->context, buf, count,
+                                                                 error))
+                               goto fail;
                 }
       
         return TRUE;
+
+ fail:
+        gdk_pixbuf_loader_ensure_error (loader, error);
+
+        priv->closed = TRUE;
+
+        if (priv->image_module && priv->holds_threadlock) 
+               {
+                       _gdk_pixbuf_unlock (priv->image_module);
+                       priv->holds_threadlock = FALSE;
+               }
+
+        return FALSE;
 }
 
 /**